from django.contrib.auth.models import AbstractUser
from django.db import models

class UserProfile(AbstractUser):
    phone = models.CharField('手机号', max_length=11)

    class Meta:
        db_table = 'user'


class BaseModel(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

    class Meta:
        abstract = True


# 第三方账号用户model
class OpenUser(models.Model):
    uid = models.CharField(max_length=20)
    type = models.CharField(max_length=10)
    user = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True)

    class Meta:
        db_table = 'open_user'